package com.sen.app.schedul.utils.cfg;

import java.io.File;

import org.apache.log4j.Logger;

import com.sen.app.schedul.core.Cfg;
import com.sen.app.schedul.core.utils.DirUtils;

/**
 * application.properties属性配置文件读取类
 * 
 * @author sen
 */
public final class AppPropReader {

	private static Logger LOG = Logger.getLogger(AppPropReader.class);
	
	/**
	 * application.properties 配置文件路径
	 */
	private static final String FILE_PATH = "file:" + DirUtils.getConfDir() 
	    + File.separator + "application.properties";

	public static String getPropertie(String key){
		try {
			return Cfg.getInstance(FILE_PATH).getContent(key);
		} catch (Exception e) {
			LOG.error("从配置文件" + FILE_PATH + " 中读取key：" + key + " 值出错！", e);
			return "";
		}
	}

	private AppPropReader() {
		//empty!
	}
}
